package com.bt.dmdb.controller.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bt.dmdb.controller.CustomerDetailsController;
import com.bt.dmdb.model.BusinessNature;
import com.bt.dmdb.model.BusinessNatureDto;
import com.bt.dmdb.model.Contact;
import com.bt.dmdb.model.ContactDto;
import com.bt.dmdb.model.EagPassiveIncome;
import com.bt.dmdb.model.ExchangeMarketDto;
import com.bt.dmdb.model.Locations;
import com.bt.dmdb.model.LocationsDto;
import com.bt.dmdb.model.Market;
import com.bt.dmdb.model.MemberStatus;
import com.bt.dmdb.model.MemberStatusDto;
import com.bt.dmdb.model.PassiveIncomeDto;
import com.bt.dmdb.model.Regulators;
import com.bt.dmdb.model.RegulatorsDto;
import com.bt.dmdb.model.RestrictedDistributor;
import com.bt.dmdb.model.RestrictedDistributorDto;
import com.bt.dmdb.model.SourceIncome;
import com.bt.dmdb.model.SourceIncomeDto;
import com.bt.dmdb.model.StocksDistribution;
import com.bt.dmdb.model.StocksDistributionDto;
import com.bt.dmdb.service.CustomerDetailsService;


@Controller
@RequestMapping("customer")
public class CustomerDetailsControllerImpl implements CustomerDetailsController{
	 @Resource
	 private CustomerDetailsService customerDetailsService;

	
	
	public CustomerDetailsService getCustomerDetailsService() {
		return customerDetailsService;
	}



	public void setCustomerDetailsService(
			CustomerDetailsService customerDetailsService) {
		this.customerDetailsService = customerDetailsService;
	}


//1st change -start
	@Override
    @RequestMapping(value = "getAllBusinessNature", method = RequestMethod.GET)
    @ResponseBody
    public List<BusinessNature> getAllBusinessNature(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllBusinessNature(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteBusinessNatureById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteBusinessNatureById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteBusinessNatureById(id);
    	 return "businessNature";
    }

	
	@Override
    @RequestMapping(value = "saveAllBusinessNature", method = RequestMethod.POST)
    @ResponseBody
    public List<BusinessNature> saveAllBusinessNature(@RequestBody BusinessNatureDto businessNatureDto) {
    	return customerDetailsService.saveAllBusinessNature(businessNatureDto);
    }
	
	
	@Override
    @RequestMapping(value = "getAllEAGMemberStatus", method = RequestMethod.GET)
    @ResponseBody
    public List<MemberStatus> getAllEAGMemberStatus(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllEAGMemberStatus(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteEAGMemberStatusById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteEAGMemberStatusById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteEAGMemberStatusById(id);
    	 return "eagMemberStatus";
    }
	

	
	@Override
    @RequestMapping(value = "saveAllEAGMemberStatus", method = RequestMethod.POST)
    @ResponseBody
    public List<MemberStatus> saveAllEAGMemberStatus(@RequestBody MemberStatusDto memberStatusDto) {
    	return customerDetailsService.saveAllEAGMemberStatus(memberStatusDto);
    }
	//1st change -end
	
	@Override
    @RequestMapping(value = "getAllEAGPassiveIncome", method = RequestMethod.GET)
    @ResponseBody
    public List<EagPassiveIncome> getAllEAGPassiveIncome(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllEAGPassiveIncome(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteEAGPassiveIncomeById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteEAGPassiveIncomeById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteEAGPassiveIncomeById(id);
    	 return "eagPassiveIncome";
    }

	
	@Override
    @RequestMapping(value = "saveAllEAGPassiveIncome", method = RequestMethod.POST)
    @ResponseBody
    public List<EagPassiveIncome> saveAllEAGPassiveIncome(@RequestBody PassiveIncomeDto passiveIncomeDto) {
    	return customerDetailsService.saveAllEAGPassiveIncome(passiveIncomeDto);
    }
	
	@Override
    @RequestMapping(value = "getAllExchangeMarket", method = RequestMethod.GET)
    @ResponseBody
    public List<Market> getAllExchangeMarket(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllExchangeMarket(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteExchangeMarketById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteExchangeMarketById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteExchangeMarketById(id);
    	 return "exchangeMarket";
    }

	
	@Override
    @RequestMapping(value = "saveAllExchangeMarket", method = RequestMethod.POST)
    @ResponseBody
    public List<Market> saveAllExchangeMarket(@RequestBody ExchangeMarketDto exchangeMarketDto) {
    	return customerDetailsService.saveAllExchangeMarket(exchangeMarketDto);
    }
	
	@Override
    @RequestMapping(value = "getAllLocations", method = RequestMethod.GET)
    @ResponseBody
    public List<Locations> getAllLocations(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllLocations(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteLocationsById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteLocationsById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteLocationsById(id);
    	 return "locations";
    }

	
	@Override
    @RequestMapping(value = "saveAllLocations", method = RequestMethod.POST)
    @ResponseBody
    public List<Locations> saveAllLocations(@RequestBody LocationsDto locationsDto) {
    	return customerDetailsService.saveAllLocations(locationsDto);
    }

	@Override
    @RequestMapping(value = "getAllRegulators", method = RequestMethod.GET)
    @ResponseBody
    public List<Regulators> getAllRegulators(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllRegulators(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteRegulatorsById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteRegulatorsById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteRegulatorsById(id);
    	 return "regulators";
    }

	
	@Override
    @RequestMapping(value = "saveAllRegulators", method = RequestMethod.POST)
    @ResponseBody
    public List<Regulators> saveAllRegulators(@RequestBody RegulatorsDto regulatorsDto) {
    	return customerDetailsService.saveAllRegulators(regulatorsDto);
    }

	@Override
    @RequestMapping(value = "getAllRestrictedDistributor", method = RequestMethod.GET)
    @ResponseBody
    public List<RestrictedDistributor> getAllRestrictedDistributor(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllRestrictedDistributor(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteRestrictedDistributorById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteRestrictedDistributorById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteRestrictedDistributorById(id);
    	 return "restrictedDistributor";
    }

	
	@Override
    @RequestMapping(value = "saveAllRestrictedDistributor", method = RequestMethod.POST)
    @ResponseBody
    public List<RestrictedDistributor> saveAllRestrictedDistributor(@RequestBody RestrictedDistributorDto restrictedDistributorDto) {
    	return customerDetailsService.saveAllRestrictedDistributor(restrictedDistributorDto);
    }

	@Override
    @RequestMapping(value = "getAllSourceIncome", method = RequestMethod.GET)
    @ResponseBody
    public List<SourceIncome> getAllSourceIncome(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllSourceIncome(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteSourceIncomeById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteSourceIncomeById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteSourceIncomeById(id);
    	 return "sourceIncome";
    }

	
	@Override
    @RequestMapping(value = "saveAllSourceIncome", method = RequestMethod.POST)
    @ResponseBody
    public List<SourceIncome> saveAllSourceIncome(@RequestBody SourceIncomeDto sourceIncomeDto) {
    	return customerDetailsService.saveAllSourceIncome(sourceIncomeDto);
    }
	
	@Override
    @RequestMapping(value = "getAllStocksDistribution", method = RequestMethod.GET)
    @ResponseBody
    public List<StocksDistribution> getAllStocksDistribution(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllStocksDistribution(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteStocksDistributionById", method = RequestMethod.GET)
    // @ResponseBody
    public void deleteStocksDistributionById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteStocksDistributionById(id);
    }

	
	@Override
    @RequestMapping(value = "saveAllStocksDistribution", method = RequestMethod.POST)
    @ResponseBody
    public List<StocksDistribution> saveAllStocksDistribution(@RequestBody StocksDistributionDto stocksDistributionDto) {
    	return customerDetailsService.saveAllStocksDistribution(stocksDistributionDto);
    }
	
	@Override
    @RequestMapping(value = "getAllContacts", method = RequestMethod.GET)
    @ResponseBody
    public List<Contact> getAllContacts(@RequestParam("id") String id) {
    	 return customerDetailsService.getAllContacts(new Long(id));
    }
	
	@Override
    @RequestMapping(value = "deleteContactById", method = RequestMethod.GET)
    // @ResponseBody
    public String deleteContactById(@RequestParam("id") Long id) {
    	 customerDetailsService.deleteContactById(id);
    	 return "sourceIncome";
    }

	
	@Override
    @RequestMapping(value = "saveAllContacts", method = RequestMethod.POST)
    @ResponseBody
    public List<Contact> saveAllContacts(@RequestBody ContactDto contactDto) {
    	return customerDetailsService.saveAllContacts(contactDto);
    }
}
